package org.springblade.modules.system.wrapper;

import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.SpringUtil;
import org.springblade.modules.system.entity.DictType;
import org.springblade.modules.system.service.IDictItemService;
import org.springblade.modules.system.vo.DictTypeVO;

public class DictTypeWrapper extends BaseEntityWrapper<DictType, DictTypeVO> {

	private static IDictItemService dictItemService;

	static {
		dictItemService = SpringUtil.getBean(IDictItemService.class);
	}

	public static DictTypeWrapper build() {
		return new DictTypeWrapper();
	}

	@Override
	public DictTypeVO entityVO(DictType dictType) {
		DictTypeVO dictTypeVO = BeanUtil.copy(dictType, DictTypeVO.class);
		String systemName = dictItemService.getLabel("dict_type", dictType.getSystem());
		dictTypeVO.setSystemName(systemName);
		return dictTypeVO;
	}
}
